package com.uuj.dome.jpa;

import com.uuj.dome.base.BaseRepository;
import com.uuj.dome.entity.UserEntity;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * ClassName:UserJpa
 * PACKAGE_NAME:com.uuj.dome.jpa
 */
@Transactional
public interface UserJpa extends BaseRepository<UserEntity, Integer> {


    @Query(value = "SELECT t_user.t_id,t_user.t_name,t_user.t_age,t_user.t_address,t_user.t_password FROM t_user WHERE t_user.t_age > ?1", nativeQuery = true)
    List<UserEntity> nativeQuery(int age);


    @Modifying
    @Query(value = "DELETE FROM t_user WHERE t_name = ? AND t_password = ?", nativeQuery = true)
    void queryDelete(String name, String password);


}
